const singUpBtn = document.querySelector('#sign-up-btn')
const singInBtn = document.querySelector('#sign-in-btn')
const container = document.querySelector('.container')

singUpBtn.addEventListener('click', () => {
  container.classList.add('sign-up-mode')
})
singInBtn.addEventListener('click', () => {
  container.classList.remove('sign-up-mode')
})



function check_reg() {
  var name = document.getElementById("uname").value;
  //去除空格
  name = name.replace(/\s+/g, "");
  if (name == "") {
    alert("用户名不能为空");
    return false;
  }

  var pwd1 = document.getElementById("pass1").value;
  var pwd2 = document.getElementById("pass2").value;
  //去除空格
  pwd1 = pwd1.replace(/\s+/g, "");
  pwd2 = pwd2.replace(/\s+/g, "");
  if(pwd1.length < 6){
    alert("密码长度不能小于6位");
    return false;
  }

  if (pwd1 == "" || pwd2 == "") {
    alert("密码不能为空");
    return false;
  }
  if (pwd1 != pwd2) {
    alert("两次输入的密码不一致");
    return false;
  }

  //判断手机号格式
  var phone = document.getElementById("uphone").value;
  if (!(/^1[3456789]\d{9}$/.test(phone))) {
    alert("手机号格式不正确");
    return false;
  }
}
